<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script>
      if (true) {
        var a = 1;
        let b = 2;
        const c = 3;
      }
      console.log(a); // var 变量提升，没有块级作用域
      // console.log(b); // let定义变量， 有作用域
      // console.log(c); // const定义常量， 有作用域

      //js中有六种数据类型，包括五种基本数据类型（Number,String,Boolean,Undefined,Null）,和3种引用数据类型（Object,Function,Array）。
      var person = {
        name: "Micheal",

        age: 24,
      };
      alert(person.name);
      var colors = ["red", "blue", "yellow"];
      console.log(colors);
      var sum = function (num1, num2) {
        return num1 + num2;
      };
      console.log(sum(1, 2));

      console.log(typeof 123); //Number

      // typeof "abc"; //String
      // typeof true; //Boolean

      // typeof undefined; //Undefined

      // typeof null; //Object

      // typeof {}; //Object

      // typeof []; //Object
    </script>
  </head>
  <body></body>
</html>
